using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._ProjectionsandTransformations._Raster
{
    /// <summary>
    /// <para>Register Raster</para>
    /// <para>Automatically aligns a raster to a reference image or uses a control point file for georegistration. If the input dataset is a mosaic dataset, the
    /// tool will operate on each mosaic dataset item. To automatically register the image, the input raster
    /// and the reference raster must be in a relatively close geographic
    /// area. The tool will run faster if the raster
    /// datasets are in close alignment. You may need to
    /// create a link file, also known as a control point file, with a few links to get your input raster into
    /// the same map space.</para>
    /// <para>自动将栅格与参考影像对齐或使用控制点文件进行地理配准。如果输入数据集是镶嵌数据集，则
    /// 工具将对每个镶嵌数据集项目进行操作。要自动注册图像，输入栅格
    /// 并且参考栅格必须位于相对接近的地理位置
    /// 面积。如果栅格
    /// 数据集紧密对齐。您可能需要
    /// 创建一个链接文件（也称为控制点文件），其中包含几个链接，以便将输入栅格放入
    /// 相同的地图空间。</para>
    /// </summary>    
    [DisplayName("Register Raster")]
    public class RegisterRaster : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public RegisterRaster()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input Raster</para>
        /// <para><xdoc>
        ///   <para>The raster that you want to realign. Registering a mosaic dataset item will update that particular item within the mosaic dataset.</para>
        ///   <para>A mosaic dataset item will have the path to the mosaic dataset followed by the Object ID of the item. For example, the first item in the mosaic dataset would have the following path: .\mosaicDataset\objectid=1.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要重新对齐的栅格。注册镶嵌数据集项目将更新镶嵌数据集中的特定项目。</para>
        ///   <para>镶嵌数据集项将具有镶嵌数据集的路径，后跟项目的对象 ID。例如，镶嵌数据集中的第一项将具有以下路径：.\mosaicDataset\objectid=1。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_register_mode">
        /// <para>Register Mode</para>
        /// <para><xdoc>
        ///   <para>Specifies the registration mode. You can either register the raster with a transformation or reset the transformation.</para>
        ///   <bulletList>
        ///     <bullet_item>Register—Apply a geometric transformation to the input raster.</bullet_item><para/>
        ///     <bullet_item>Register multispectral—Register the multispectral input to the panchromatic input. This is only used for mosaic datasets that have a misalignment between the two.</bullet_item><para/>
        ///     <bullet_item>Reset— Remove the geometric transformation previously added by this tool.</bullet_item><para/>
        ///     <bullet_item>Create links—Create a link file with automatically generated links.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定注册模式。您可以使用变换注册栅格，也可以重置变换。</para>
        ///   <bulletList>
        ///     <bullet_item>寄存器 - 将几何变换应用于输入栅格。</bullet_item><para/>
        ///     <bullet_item>寄存器多光谱 （Register multispectral） - 将多光谱输入寄存到全色输入。这仅用于两者之间未对齐的镶嵌数据集。</bullet_item><para/>
        ///     <bullet_item>重置 （Reset） - 移除之前由此工具添加的几何变换。</bullet_item><para/>
        ///     <bullet_item>创建链接 - 使用自动生成的链接创建链接文件。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public RegisterRaster(object _in_raster, _register_mode_value _register_mode)
        {
            this._in_raster = _in_raster;
            this._register_mode = _register_mode;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Register Raster";

        public override string CallName => "management.RegisterRaster";

        public override List<string> AcceptEnvironments => ["parallelProcessingFactor"];

        public override object[] ParameterInfo => [_in_raster, _register_mode.GetGPValue(), _reference_raster, _input_link_file, _transformation_type.GetGPValue(), _output_cpt_link_file, _maximum_rms_value, _out_raster];

        /// <summary>
        /// <para>Input Raster</para>
        /// <para><xdoc>
        ///   <para>The raster that you want to realign. Registering a mosaic dataset item will update that particular item within the mosaic dataset.</para>
        ///   <para>A mosaic dataset item will have the path to the mosaic dataset followed by the Object ID of the item. For example, the first item in the mosaic dataset would have the following path: .\mosaicDataset\objectid=1.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要重新对齐的栅格。注册镶嵌数据集项目将更新镶嵌数据集中的特定项目。</para>
        ///   <para>镶嵌数据集项将具有镶嵌数据集的路径，后跟项目的对象 ID。例如，镶嵌数据集中的第一项将具有以下路径：.\mosaicDataset\objectid=1。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Register Mode</para>
        /// <para><xdoc>
        ///   <para>Specifies the registration mode. You can either register the raster with a transformation or reset the transformation.</para>
        ///   <bulletList>
        ///     <bullet_item>Register—Apply a geometric transformation to the input raster.</bullet_item><para/>
        ///     <bullet_item>Register multispectral—Register the multispectral input to the panchromatic input. This is only used for mosaic datasets that have a misalignment between the two.</bullet_item><para/>
        ///     <bullet_item>Reset— Remove the geometric transformation previously added by this tool.</bullet_item><para/>
        ///     <bullet_item>Create links—Create a link file with automatically generated links.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定注册模式。您可以使用变换注册栅格，也可以重置变换。</para>
        ///   <bulletList>
        ///     <bullet_item>寄存器 - 将几何变换应用于输入栅格。</bullet_item><para/>
        ///     <bullet_item>寄存器多光谱 （Register multispectral） - 将多光谱输入寄存到全色输入。这仅用于两者之间未对齐的镶嵌数据集。</bullet_item><para/>
        ///     <bullet_item>重置 （Reset） - 移除之前由此工具添加的几何变换。</bullet_item><para/>
        ///     <bullet_item>创建链接 - 使用自动生成的链接创建链接文件。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Register Mode")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _register_mode_value _register_mode { get; set; }

        public enum _register_mode_value
        {
            /// <summary>
            /// <para>Register</para>
            /// <para>Register—Apply a geometric transformation to the input raster.</para>
            /// <para>寄存器 - 将几何变换应用于输入栅格。</para>
            /// </summary>
            [Description("Register")]
            [GPEnumValue("REGISTER")]
            _REGISTER,

            /// <summary>
            /// <para>Register multispectral</para>
            /// <para>Register multispectral—Register the multispectral input to the panchromatic input. This is only used for mosaic datasets that have a misalignment between the two.</para>
            /// <para>寄存器多光谱 （Register multispectral） - 将多光谱输入寄存到全色输入。这仅用于两者之间未对齐的镶嵌数据集。</para>
            /// </summary>
            [Description("Register multispectral")]
            [GPEnumValue("REGISTER_MS")]
            _REGISTER_MS,

            /// <summary>
            /// <para>Reset</para>
            /// <para>Reset— Remove the geometric transformation previously added by this tool.</para>
            /// <para>重置 （Reset） - 移除之前由此工具添加的几何变换。</para>
            /// </summary>
            [Description("Reset")]
            [GPEnumValue("RESET")]
            _RESET,

            /// <summary>
            /// <para>Create links</para>
            /// <para>Create links—Create a link file with automatically generated links.</para>
            /// <para>创建链接 - 使用自动生成的链接创建链接文件。</para>
            /// </summary>
            [Description("Create links")]
            [GPEnumValue("CREATE_LINKS")]
            _CREATE_LINKS,

        }

        /// <summary>
        /// <para>Reference Raster</para>
        /// <para>The raster dataset that will align the input raster dataset. Leave this parameter empty if you want to register your multispectral mosaic dataset items to their associated panchromatic raster datasets.</para>
        /// <para>将对齐输入栅格数据集的栅格数据集。如果要将多光谱镶嵌数据集项目注册到其关联的全色栅格数据集，请将此参数留空。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Reference Raster")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _reference_raster { get; set; } = null;


        /// <summary>
        /// <para>Input Link File</para>
        /// <para>The file that has the coordinates to link the input raster dataset with the reference. The input link table works with one mosaic item in the mosaic layer. The input must specify which item is being processed, either selecting the item or specifying the ObjectID in the input. Leave this parameter empty to register multispectral mosaic dataset items with the associated panchromatic raster datasets.</para>
        /// <para>具有用于将输入栅格数据集与参考链接的坐标的文件。输入链接表适用于镶嵌图层中的一个镶嵌项目。输入必须指定正在处理的项，选择项或指定输入中的 ObjectID。将此参数留空，可将多光谱镶嵌数据集项目注册到关联的全色栅格数据集中。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Link File")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _input_link_file { get; set; } = null;


        /// <summary>
        /// <para>Transformation Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the method for shifting the raster dataset.</para>
        ///   <bulletList>
        ///     <bullet_item>Shift only— This method uses a zero-order polynomial to shift your data. This is commonly used when your data is already georeferenced, but a small shift will better line up your data. Only one link is required to perform a zero-order polynomial shift.</bullet_item><para/>
        ///     <bullet_item>Similarity transformation— This is a first-order transformation that attempts to preserve the shape of the original raster. The RMS error tends to be higher than other polynomial transformations because the preservation of shape is more important than the best fit.</bullet_item><para/>
        ///     <bullet_item>Affine transformation—A first-order polynomial (affine) fits a flat plane to the input points.</bullet_item><para/>
        ///     <bullet_item>Second-order polynomial transformation—A second-order polynomial fits a somewhat more complicated surface to the input points.</bullet_item><para/>
        ///     <bullet_item>Third-order polynomial transformation—A third-order polynomial fits a more complicated surface to the input points.</bullet_item><para/>
        ///     <bullet_item>Adjust transformation— This method combines a polynomial transformation and uses a triangulated irregular network (TIN) interpolation technique to optimize for both global and local accuracy.</bullet_item><para/>
        ///     <bullet_item>Spline transformation— This method transforms the source control points precisely to the target control points. In the output, the control points will be accurate, but the raster pixels between the control points are not.</bullet_item><para/>
        ///     <bullet_item>Projective transformation— This method warps lines so they remain straight. In doing so, lines that were once parallel may no longer remain parallel. The projective transformation is especially useful for oblique imagery, scanned maps, and for some imagery products.</bullet_item><para/>
        ///     <bullet_item>Frame transformation—This method uses an image resection algorithm on aerial images. The image resection algorithm refines the exterior orientation (perspective, omega, phi, and kappa) of the image from known ground control points, using a least-square fitting method. Each image must have at least three noncollinear points. When the input is a mosaic dataset, it will register the selected images one at a time.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定移动栅格数据集的方法。</para>
        ///   <bulletList>
        ///     <bullet_item>仅移位 — 此方法使用零阶多项式来移位数据。当您的数据已经进行了地理配准时，通常会使用此方法，但较小的偏移将更好地排列数据。只需一个链路即可执行零阶多项式移位。</bullet_item><para/>
        ///     <bullet_item>相似性变换 - 这是一种一阶变换，旨在保留原始栅格的形状。RMS 误差往往高于其他多项式变换，因为形状的保持比最佳拟合更重要。</bullet_item><para/>
        ///     <bullet_item>仿射变换 - 一阶多项式（仿射）将平面拟合到输入点。</bullet_item><para/>
        ///     <bullet_item>二阶多项式变换 - 二阶多项式将稍微复杂的曲面拟合到输入点。</bullet_item><para/>
        ///     <bullet_item>三阶多项式变换 - 三阶多项式将更复杂的曲拟合到输入点。</bullet_item><para/>
        ///     <bullet_item>调整变换 — 此方法结合了多项式变换，并使用三角不规则网络 （TIN） 插值技术来优化全局和局部精度。</bullet_item><para/>
        ///     <bullet_item>样条变换 — 此方法将源控制点精确地转换为目标控制点。在输出中，控制点将准确，但控制点之间的栅格像素则不准确。</bullet_item><para/>
        ///     <bullet_item>投影变换 - 此方法使线变形，使其保持笔直。这样一来，曾经平行的线可能不再保持平行。投影变换对于倾斜影像、扫描地图和某些影像产品特别有用。</bullet_item><para/>
        ///     <bullet_item>帧变换 - 此方法对航空影像使用影像切除算法。图像切除算法使用最小二乘拟合方法从已知地面控制点细化图像的外部方向（透视、omega、phi 和 kappa）。每个图像必须至少有三个非共线点。当输入是镶嵌数据集时，它将一次注册一个选定的图像。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Transformation Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _transformation_type_value _transformation_type { get; set; } = _transformation_type_value._POLYORDER1;

        public enum _transformation_type_value
        {
            /// <summary>
            /// <para>Shift only</para>
            /// <para>Shift only— This method uses a zero-order polynomial to shift your data. This is commonly used when your data is already georeferenced, but a small shift will better line up your data. Only one link is required to perform a zero-order polynomial shift.</para>
            /// <para>仅移位 — 此方法使用零阶多项式来移位数据。当您的数据已经进行了地理配准时，通常会使用此方法，但较小的偏移将更好地排列数据。只需一个链路即可执行零阶多项式移位。</para>
            /// </summary>
            [Description("Shift only")]
            [GPEnumValue("POLYORDER0")]
            _POLYORDER0,

            /// <summary>
            /// <para>Similarity transformation</para>
            /// <para>Similarity transformation— This is a first-order transformation that attempts to preserve the shape of the original raster. The RMS error tends to be higher than other polynomial transformations because the preservation of shape is more important than the best fit.</para>
            /// <para>相似性变换 - 这是一种一阶变换，旨在保留原始栅格的形状。RMS 误差往往高于其他多项式变换，因为形状的保持比最佳拟合更重要。</para>
            /// </summary>
            [Description("Similarity transformation")]
            [GPEnumValue("POLYSIMILARITY")]
            _POLYSIMILARITY,

            /// <summary>
            /// <para>Affine transformation</para>
            /// <para>Affine transformation—A first-order polynomial (affine) fits a flat plane to the input points.</para>
            /// <para>仿射变换 - 一阶多项式（仿射）将平面拟合到输入点。</para>
            /// </summary>
            [Description("Affine transformation")]
            [GPEnumValue("POLYORDER1")]
            _POLYORDER1,

            /// <summary>
            /// <para>Second-order polynomial transformation</para>
            /// <para>Second-order polynomial transformation—A second-order polynomial fits a somewhat more complicated surface to the input points.</para>
            /// <para>二阶多项式变换 - 二阶多项式将稍微复杂的曲面拟合到输入点。</para>
            /// </summary>
            [Description("Second-order polynomial transformation")]
            [GPEnumValue("POLYORDER2")]
            _POLYORDER2,

            /// <summary>
            /// <para>Third-order polynomial transformation</para>
            /// <para>Third-order polynomial transformation—A third-order polynomial fits a more complicated surface to the input points.</para>
            /// <para>三阶多项式变换 - 三阶多项式将更复杂的曲拟合到输入点。</para>
            /// </summary>
            [Description("Third-order polynomial transformation")]
            [GPEnumValue("POLYORDER3")]
            _POLYORDER3,

            /// <summary>
            /// <para>Projective transformation</para>
            /// <para>Projective transformation— This method warps lines so they remain straight. In doing so, lines that were once parallel may no longer remain parallel. The projective transformation is especially useful for oblique imagery, scanned maps, and for some imagery products.</para>
            /// <para>投影变换 - 此方法使线变形，使其保持笔直。这样一来，曾经平行的线可能不再保持平行。投影变换对于倾斜影像、扫描地图和某些影像产品特别有用。</para>
            /// </summary>
            [Description("Projective transformation")]
            [GPEnumValue("PROJECTIVE")]
            _PROJECTIVE,

            /// <summary>
            /// <para>Spline transformation</para>
            /// <para>Spline transformation— This method transforms the source control points precisely to the target control points. In the output, the control points will be accurate, but the raster pixels between the control points are not.</para>
            /// <para>样条变换 — 此方法将源控制点精确地转换为目标控制点。在输出中，控制点将准确，但控制点之间的栅格像素则不准确。</para>
            /// </summary>
            [Description("Spline transformation")]
            [GPEnumValue("SPLINE")]
            _SPLINE,

            /// <summary>
            /// <para>Adjust transformation</para>
            /// <para>Adjust transformation— This method combines a polynomial transformation and uses a triangulated irregular network (TIN) interpolation technique to optimize for both global and local accuracy.</para>
            /// <para>调整变换 — 此方法结合了多项式变换，并使用三角不规则网络 （TIN） 插值技术来优化全局和局部精度。</para>
            /// </summary>
            [Description("Adjust transformation")]
            [GPEnumValue("ADJUST")]
            _ADJUST,

            /// <summary>
            /// <para>Frame transformation</para>
            /// <para>Frame transformation—This method uses an image resection algorithm on aerial images. The image resection algorithm refines the exterior orientation (perspective, omega, phi, and kappa) of the image from known ground control points, using a least-square fitting method. Each image must have at least three noncollinear points. When the input is a mosaic dataset, it will register the selected images one at a time.</para>
            /// <para>帧变换 - 此方法对航空影像使用影像切除算法。图像切除算法使用最小二乘拟合方法从已知地面控制点细化图像的外部方向（透视、omega、phi 和 kappa）。每个图像必须至少有三个非共线点。当输入是镶嵌数据集时，它将一次注册一个选定的图像。</para>
            /// </summary>
            [Description("Frame transformation")]
            [GPEnumValue("FRAME")]
            _FRAME,

        }

        /// <summary>
        /// <para>Output Link File</para>
        /// <para>If specified, a text file will be written containing the links created by this tool. This file can be used in the Warp From File tool. The output link table works with one mosaic dataset item in the mosaic layer. The input must specify which item is being processed, either selecting the item or specifying the ObjectID in the input.</para>
        /// <para>如果指定，将编写一个文本文件，其中包含此工具创建的链接。此文件可在“从文件变形”工具中使用。输出链接表适用于镶嵌图层中的一个镶嵌数据集项目。输入必须指定正在处理的项，选择项或指定输入中的 ObjectID。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Link File")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_cpt_link_file { get; set; } = null;


        /// <summary>
        /// <para>Maximum RMS</para>
        /// <para>The amount of modeled error (in pixels) that you want in the output. The default is 0.5, and values below 0.3 are not recommended as this leads to overfitting.</para>
        /// <para>您希望在输出中出现的建模误差量（以像素为单位）。默认值为 0.5，不建议使用低于 0.3 的值，因为这会导致过拟合。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum RMS")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _maximum_rms_value { get; set; } = null;


        /// <summary>
        /// <para>Registered Raster</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Registered Raster")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_raster { get; set; }


        public RegisterRaster SetEnv(object parallelProcessingFactor = null)
        {
            base.SetEnv(parallelProcessingFactor: parallelProcessingFactor);
            return this;
        }

    }

}